<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<title>명함관리시스템 - 수신함</title>
<link rel="stylesheet" type="text/css" href="/style/css/adminbase.css" media="screen" />

<script type="text/javascript" src="${ctx}/style/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/style/js/jquery_ui.js"></script>

<script type="text/javascript">

function setCategoryId(obj) {
	var categoryId = $(obj).val();
	if (categoryId == 0) {
		$('form#listForm').attr('action', '/ws/card/list');
	}
	else {
		$('form#listForm').attr('action', '/ws/card/list/' + categoryId);
	}
}

function receive() {
	$('form#actionForm').attr('action', '/ws/receipt');
	$('form#actionForm').submit();
}

function reject() {
	$('form#actionForm').attr('action', '/ws/receipt/reject');
	$('form#actionForm').submit();
}

</script>
</head>
<body>
	<h3>수신함</h3>
	
	<div class="contents" style="width:300px;">
	
	<c:choose>
	<c:when test="${!empty it.nameCardList}">
	<form id="actionForm" action="" method="post">
	<c:forEach var="nameCardDto" items="${it.nameCardList}">
	<div class="nameCard">
	<table>
		<col width="200"/>
		<col width="60"/>
		<tbody>
			<tr>
				<td>${nameCardDto.name}</td>
				<td rowspan="3">
					<img src="/ws/card/photo/${nameCardDto.imageBlobKey}" />
				</td>
			</tr>
			<tr><td>${nameCardDto.address}</td></tr>
			<tr><td>tel : ${nameCardDto.telephone}</td></tr>
			<tr>
				<td>email : ${nameCardDto.email}</td>
			</tr>
			<tr>
				<td colspan="2" align="right">
				<input type="checkbox" name="nameCardOId" value="${nameCardDto.nameCardKeyId}" />
				</td>
			</tr>
		</tbody>
	</table>
	</div>
	</c:forEach>
	
	<div class="spacer10"></div>
	
	<div style="float:right;">
	<span>카테고리 : </span>
	<select name="categoryId">
		<option value="0">선택</option>
		<c:forEach var="category" items="${it.categories}">
			<option value="${category.categoryOId}"}>${category.categoryName}</option>
		</c:forEach>
	</select>
	<a href="#" onclick="receive();">받기</a>
	<a href="#" onclick="reject();">거부</a>
	<a href="/ws/main">홈으로</a>
	</div>
	</form>
	</c:when>
	<c:otherwise>
	<div class="spacer10"></div>
	<pre>수신된 명함이 없습니다.</pre>
	<a href="/ws/main">홈으로</a>
	</c:otherwise>
	</c:choose>
	</div>
</body>
</html>